package com.fph.design.factory.impl;

import com.fph.design.factory.ICacheAdapter;
import com.fph.design.matter.EGM;

import java.util.concurrent.TimeUnit;

/**
 * @ClassName EGMCacheAdapter
 * @Description TODO
 * @Author fph
 * @Date 2024-07-10 9:12
 **/
public class EGMCacheAdapter implements ICacheAdapter {

    private EGM egm = new EGM();
    @Override
    public String get(String key) {
        return egm.gain(key);
    }

    @Override
    public void set(String key, String value) {
        egm.set(key, value);
    }

    @Override
    public void set(String key, String value, long timeout, TimeUnit timeUnit) {
        egm.setEx(key, value, timeout, timeUnit);
    }

    @Override
    public void del(String key) {
        egm.delete(key);
    }
}

